package cn.szabadsag.hrm.doc;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * ES文档对象
 * @author yangcong
 * @date 2022年04月10日 19:55
 * @since
 * indexName:索引库
 * type:数据表的类型，ES7取消了type
 */
@Document(indexName = "course",type = "_doc")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseDoc {

    //  对应ES文档的id
    @Id
    private Long id;

    //  课程名字
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;

    //  课程等级
    @Field(type = FieldType.Keyword)
    private String gradeName;

    //  课程分类
    @Field(type = FieldType.Long)
    private Long courseTypeId;

    //  机构名称
    @Field(type = FieldType.Keyword)
    private String tenantName;

    //  封面
    @Field(type = FieldType.Keyword)
    private String pic;

    //  销量
    @Field(type = FieldType.Integer)
    private Integer saleCount;

    //  浏览量
    @Field(type = FieldType.Integer)
    private Integer viewCount;

    //  评论量
    @Field(type = FieldType.Integer)
    private Integer commentCount;

    //  是否免费
    @Field(type = FieldType.Keyword)
    private String chargeName;

    //  价格
    @Field(type = FieldType.Float)
    private Float price;

    //  原价
    @Field(type = FieldType.Float)
    private Float priceOld;

    //  上线时间
    @Field(type = FieldType.Date)
    private Date onlineTime;

}
